﻿using Base.ModuleBase.Dialogs.ViewModels;
using Base.ModuleBase.Dialogs.Views;
using DryIoc;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using WPF_Prism_Test.Views;

namespace WPF_Prism_Test
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override IModuleCatalog CreateModuleCatalog()
        {
            var dir = Path.Combine(Environment.CurrentDirectory, "Modules/");
            return new DirectoryModuleCatalog() { ModulePath = dir };

            //return new DirectoryModuleCatalog() { ModulePath = Environment.CurrentDirectory };
        }

        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            base.ConfigureModuleCatalog(moduleCatalog);
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterDialog<InfoDialog, InfoDialogViewModel>();
            containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogViewModel>();
            containerRegistry.RegisterDialog<TipDialog, TipDialogViewModel>();

            containerRegistry.RegisterDialogWindow<CommmonDialogWindow>();
        }
    }
}
